//
// Unihan Input Method
//
// Copyright © 2002-2007 Sun Wah Linux Ltd.
//
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
// USA
//
// $Id: unihan2.c 769 2007-05-14 03:39:06Z roger $
//


#ifndef __LOG_H
#define __LOG_H

#include <stdarg.h>

typedef enum {
    LOG_LEVEL_ERROR     = 1 << 2,
    LOG_LEVEL_CRITICAL  = 1 << 3,
    LOG_LEVEL_WARNING   = 1 << 4,
    LOG_LEVEL_MESSAGE   = 1 << 5,
    LOG_LEVEL_INFO      = 1 << 6,
    LOG_LEVEL_DEBUG     = 1 << 7
} LogLevelFlags;

void unihan_logv(const char *log_domain, LogLevelFlags log_level, const char *format, va_list args);
void unihan_log(const char *log_domain, LogLevelFlags log_level, const char *format, ...);

void unihan_log_set_stdout(FILE *stdout_fd);
void unihan_log_set_stderr(FILE *stderr_fd);

void unihan_log_init(void);

#ifndef LOG_DOMAIN
#define LOG_DOMAIN  ((char *)NULL)
#endif

#define unihan_error(...)       unihan_log(LOG_DOMAIN, LOG_LEVEL_ERROR, __VA_ARGS__)
#define unihan_critical(...)    unihan_log(LOG_DOMAIN, LOG_LEVEL_CRITICAL, __VA_ARGS__)
#define unihan_warning(...)     unihan_log(LOG_DOMAIN, LOG_LEVEL_WARNING, __VA_ARGS__)
#define unihan_message(...)     unihan_log(LOG_DOMAIN, LOG_LEVEL_MESSAGE, __VA_ARGS__)
#define unihan_debug(...)       unihan_log(LOG_DOMAIN, LOG_LEVEL_DEBUG, __VA_ARGS__)

#endif /* __LOG_H */

// vi:ts=4:sw=4:nowrap:cin:expandtab
